import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns : BasicColumn[] = [
	{
		title: '景点',
		align: "center",
		dataIndex: 'scenicSpotId_dictText'
	},
	{
		title: '标题',
		align: "center",
		dataIndex: 'title'
	},
	{
		title: '出发日期',
		align: "center",
		dataIndex: 'departTime',
		customRender: ({ text }) => {
			return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text)
		},
	},
	{
		title: '结束日期',
		align: "center",
		dataIndex: 'endTime',
		customRender: ({ text }) => {
			return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text)
		},
	},
	{
		title: '活动天数',
		align: "center",
		dataIndex: 'dayNum_dictText'
	},
	/* {
		title: '类型',
		align: "center",
		dataIndex: 'activityType_dictText'
	}, */
	{
		title: '上下架',
		align: "center",
		dataIndex: 'unmount_dictText'
	},
	{
		title: '上车地点',
		align: "center",
		dataIndex: 'upCarAddressId_dictText'
	},
	{
		title: '接送点',
		align: "center",
		dataIndex: 'pickUpPointId_dictText'
	},
	{
		title: '车型',
		align: "center",
		dataIndex: 'vehicleModelId_dictText'
	},
	{
		title: '划线价',
		align: "center",
		sorter: true,
		dataIndex: 'marketPrice'
	},

	{
		title: '拼车价',
		align: "center",
		sorter: true,
		dataIndex: 'carpoolPrice'
	},
	{
		title: '包车价',
		align: "center",
		sorter: true,
		dataIndex: 'charterPrice'
	},
	{
		title: '租户',
		align: "center",
		dataIndex: 'tenantId_dictText'
	},
	{
		title: '出发城市',
		align: "center",
		dataIndex: 'cityId_dictText'
	},
];
//查询数据
export const searchFormSchema : FormSchema[] = [
	{
		label: "标题",
		field: "title",
		component: 'Input',
		//colProps: {span: 6},
	},
	{
		label: '出发日期',
		field: 'departTime',
		component: 'DatePicker',
	},
	/* 	{
			label: "类型",
			field: "activityType",
			component: 'JDictSelectTag',
			componentProps: {
				dictCode: "activity_type"
			},
			//colProps: {span: 6},
		}, */
	{
		label: "上下架",
		field: "unmount",
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "unmount"
		},
		//colProps: {span: 6},
	},

];

//表单数据
export const formSchema : FormSchema[] = [
	{
		label: '景点',
		field: 'scenicSpotId',
		component: 'JSearchSelect',
		componentProps: {
			dict: "couple_shop,title,id,shop_category = 1"
		},
	},
	{
		label: '标题',
		field: 'title',
		component: 'Input',
	},
	{
		label: '出发日期',
		field: 'departTime',
		component: 'DatePicker',
	},
	{
		label: '结束日期',
		field: 'endTime',
		component: 'DatePicker',
	},
	{
		label: '活动天数',
		field: 'dayNum',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "day_num"
		},
	},
	/* 	{
			label: '类型',
			field: 'activityType',
			component: 'JDictSelectTag',
			componentProps: {
				dictCode: "activity_type"
			},
		}, */
	{
		label: '上下架',
		field: 'unmount',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "unmount"
		},
	},
	{
		label: '出发城市',
		field: 'cityId',
		component: 'JTreeDict',
		componentProps: { async: true, parentCode: 'A02' },
	},
	{
		label: '上车地点',
		field: 'upCarAddressId',
		component: 'JSelectMultiple',
		componentProps: {
			dictCode: "couple_pick_up_point,address,id"
		},
	},
	{
		label: '车型选择',
		field: 'vehicleModelId',
		component: 'JPopup',
		componentProps: ({ formActionType }) => {
			const { setFieldsValue } = formActionType;
			return {
				setFieldsValue: setFieldsValue,
				code: "scenic_spot_select_car_model",
				fieldConfig: [
					{ source: 'id', target: 'vehicleModelId' },
				],
				multi: true
			}
		},
	},
	{
		label: '接送范围',
		field: 'pickUpPointId',
		component: 'JSelectMultiple',
		componentProps: {
			dictCode: "couple_activity_map_draw_acircle,title,id"
		},
	},
	{
		label: '划线价',
		field: 'marketPrice',
		component: 'InputNumber',
	},
	{
		label: '拼车价',
		field: 'carpoolPrice',
		component: 'InputNumber',
	},
	{
		label: '包车价',
		field: 'charterPrice',
		component: 'InputNumber',
	},


	{
		label: '活动详情',
		field: 'activityDetail',
		component: 'JEditor',
	},
	{
		label: '行程详情',
		field: 'ltineraryDetail',
		component: 'JEditor',
	},
	{
		label: '费用详情',
		field: 'feeDetail',
		component: 'JEditor',
	},
	{
		label: '活动须知',
		field: 'activityInstruction',
		component: 'JEditor',
	},

	{
		label: '租户',
		field: 'tenantId',
		component: 'JSearchSelect',
		componentProps: {
			dict: "sys_tenant,name,id"
		},
	},

	// TODO 主键隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
];

//子表列表数据
export const coupleActivityWeekPricePerPersonColumns : BasicColumn[] = [
	/* {
		title: '活动行程',
		align: "center",
		dataIndex: 'mainId_dictText'
	}, */
	{
		title: '几份',
		align: "center",
		dataIndex: 'severalNum'
	},
	{
		title: '价格/份',
		align: "center",
		dataIndex: 'price'
	},
];
//子表表单数据
export const coupleActivityWeekPricePerPersonFormSchema : FormSchema[] = [
	// TODO 子表隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
	/* {
		label: '活动行程',
		field: 'mainId',
		component: 'JSearchSelect',
		componentProps: {
			dict: "couple_activity_main,title,id"
		},
	}, */
	{
		label: '几份',
		field: 'severalNum',
		component: 'InputNumber',
	},
	{
		label: '价格/份',
		field: 'price',
		component: 'InputNumber',
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: false },
				{ pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!' },
			];
		},
	},
];
//子表列表数据
export const coupleActivityCalendarColumns: BasicColumn[] = [
   {
    title: '活动标题',
    align:"center",
    dataIndex: 'activityTitle'
   },
   {
    title: '开始日期',
    align:"center",
    dataIndex: 'startDay',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '结束日期',
    align:"center",
    dataIndex: 'endDay',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '报名截止时间',
    align:"center",
    dataIndex: 'applyDeadline'
   },
];
//子表表单数据
export const coupleActivityCalendarFormSchema: FormSchema[] = [
  // TODO 子表隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
  {
    label: '活动标题',
    field: 'activityTitle',
    component: 'Input',
  },
  {
    label: '报名截止时间',
    field: 'applyDeadline',
    component: 'DatePicker',
    componentProps: {
       showTime:true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '开始日期',
    field: 'startDay',
    component: 'DatePicker',
  },
  {
    label: '结束日期',
    field: 'endDay',
    component: 'DatePicker',
  },

];